
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<h:panelGrid columns="1">
		<h:outputText escape="false" value="Pls Select Item to add:"
			id="selectedNode" />

		<h:panelGroup>

			<a4j:commandButton action="#{todoaction.editSubjectTodo}"
				value="Add Todo"></a4j:commandButton>
			<a4j:commandButton action="#{mylogaction.editSubjectLog}"
				value="Add Log"></a4j:commandButton>

		</h:panelGroup>
	</h:panelGrid>


	<h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
		<h:panelGroup>
			<rich:contextMenu attached="false" id="menutodo" submitMode="ajax">

				<rich:menuItem reRender="todos,mylogs" ajaxSingle="true"
					action="#{todoaction.finishToLog}">
					<b>Log this todo:</b>[{todoitem}]
	<a4j:actionparam name="todoid" assignTo="#{todoaction.todoId}"
						value="{todoitemid}"></a4j:actionparam>
				</rich:menuItem>
				 <rich:menuSeparator id="menusep1"/>
				<rich:menuItem reRender="todos" ajaxSingle="true"
					action="#{todoaction.deleteById}">
					<b>Delete Todo:</b>[{todoitem}]
	<a4j:actionparam name="todoid" assignTo="#{todoaction.todoId}"
						value="{todoitemid}"></a4j:actionparam>
				</rich:menuItem>

			</rich:contextMenu>

			<rich:dataTable id="todos" value="#{curTodos}" var="mytodo">
				<rich:column>
					<f:facet name="header">Name</f:facet>
			#{mytodo.name}
			</rich:column>
				<rich:column>
					<f:facet name="header">Content</f:facet>
					<s:formattedText value="#{mytodo.content}" />
				</rich:column>

				<rich:componentControl event="onRowClick" for="menutodo"
					operation="show">
					<f:param value="#{mytodo.id}" name="todoitemid" />
					<f:param value="#{mytodo.name}" name="todoitem" />
				</rich:componentControl>
			</rich:dataTable>

		</h:panelGroup>
		<h:panelGroup>

			<rich:contextMenu attached="false" id="menulog" submitMode="ajax">

				<rich:menuItem  ajaxSingle="true"
					action="#{mylogaction.editSubjectLog}">
					<b>Edit Log:</b>[{logitem}]
	<a4j:actionparam name="logid" assignTo="#{mylogaction.logId}"
						value="{logitemid}"></a4j:actionparam>
				</rich:menuItem>
				
				<rich:menuSeparator id="menusep2"/>

				<rich:menuItem reRender="mylogs" ajaxSingle="true"
					action="#{mylogaction.deleteById}">
					<b>Delete Log:</b>[{logitem}]
	<a4j:actionparam name="logid" assignTo="#{mylogaction.logId}"
						value="{logitemid}"></a4j:actionparam>
				</rich:menuItem>
				
				
				

			</rich:contextMenu>

			<rich:dataTable id="mylogs" value="#{curLogs}" var="mylog">
				<rich:column>
					<f:facet name="header">Name</f:facet>
			#{mylog.name}
			</rich:column>
				<rich:column>
					<f:facet name="header">Content</f:facet>
					<s:formattedText value="#{mylog.content}" />
				</rich:column>

				<rich:componentControl event="onRowClick" for="menulog"
					operation="show">
					<f:param value="#{mylog.id}" name="logitemid" />
					<f:param value="#{mylog.name}" name="logitem" />
				</rich:componentControl>
			</rich:dataTable>
		</h:panelGroup>
	</h:panelGrid>

</ui:composition>
